﻿// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT License.
// See the LICENSE file in the project root for more information.

//
// Reactive Excel implementation using classic Rx to demonstrate the concepts around
// building reactive computational graphs.
//

//
// Revision history:
//
// BD - November 2014 - Created this file.
//

namespace Rxcel
{
    internal sealed class BinaryExcelExpression : ExcelExpression
    {
        internal BinaryExcelExpression(ExcelExpressionKind kind, ExcelExpression left, ExcelExpression right)
        {
            Kind = kind;
            Left = left;
            Right = right;
        }

        public override ExcelExpressionKind Kind { get; }

        public ExcelExpression Left { get; }

        public ExcelExpression Right { get; }

        protected internal override TResult Accept<TResult>(ExcelExpressionVisitor<TResult> visitor)
        {
            return visitor.VisitBinary(this);
        }

        public override string ToString()
        {
            return Kind.ToString() + "(" + Left.ToString() + ", " + Right.ToString() + ")";
        }
    }
}
